package com.nuaa.service.login.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.nuaa.dao.inter.AdminDaoInter;
import com.nuaa.dao.login.inter.LoginDaoInter;
import com.nuaa.domain.user.admin.AdminInfo;
import com.nuaa.domain.user.customer.CustomerInfo;
import com.nuaa.service.login.inter.LoginServiceInter;

/**用户登录Service*/
@Service("loginService")
public class LoginServiceImpl implements LoginServiceInter{
	@Resource(name="loginDao")
	private LoginDaoInter loginDao;
	
	@Resource
	private AdminDaoInter adminDao;
	
	/**根据用户名密码获取应保存入session中的用户信息*/
	@Override
	public CustomerInfo getCustomerInfo(String login_name, String login_password) {
			return this.loginDao.getCustomerInfo(login_name, login_password);
	}
	
	/**
	 * 根据用户名密码获取AdminInfo
	 * @param login_name
	 * @param login_password
	 * @return AdminInfo
	 */ 
	public AdminInfo getAdmin(String login_name,String login_password){
		List<AdminInfo> adminList = adminDao.getAdminInfo(login_name, login_password);
		if(adminList!=null&&adminList.size()>0)
			return adminList.get(0);
		return null;
		
	}
	
	
}
